from socket import *

HOST = 'localhost'
PORT = 10000
BUFSIZ = 1024
ADDR = (HOST, PORT)

tcpClientSock = socket(AF_INET, SOCK_STREAM)
tcpClientSock.connect(ADDR)

while True:
    data = input('> ')
    if not data:
        break
    tcpClientSock.send(bytes(data))
    data = tcpClientSock.recv(BUFSIZ)
    if not data:
        break
    print(data)

tcpClientSock.close()
